/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.lottery.game.core.modules.service.app;

import com.lottery.game.core.modules.entity.user.ReceivingBankAccount;
import com.lottery.game.core.modules.mapper.ReceivingBankAccountDao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;

/**
 * 收款账户设置Service
 * @author ss
 * @version 2018-05-23
 */
@Service
public class ReceivingBankAccountService {

	@Autowired
	private ReceivingBankAccountDao receivingBankAccountDao;

	public ReceivingBankAccount get(String id) {
		return this.receivingBankAccountDao.get(id);
	}

	public List<ReceivingBankAccount> findList(ReceivingBankAccount receivingBankAccount) {
		return this.receivingBankAccountDao.findList(receivingBankAccount);
	}

	@Transactional(readOnly = false)
	public void save(ReceivingBankAccount receivingBankAccount) {
		if (receivingBankAccount.getId() == null) {
			receivingBankAccount.setId(UUID.randomUUID().toString().replace("-",""));
			this.receivingBankAccountDao.insert(receivingBankAccount);
		}else{
			this.receivingBankAccountDao.update(receivingBankAccount);
		}
	}

	@Transactional(readOnly = false)
	public void delete(ReceivingBankAccount receivingBankAccount) {
		this.receivingBankAccountDao.delete(receivingBankAccount);
	}

}
